// 统一管理权限相关接口
import http from '@/utils/request'

import type { permissionListType, permissionParams } from './type.ts'

// 通过枚举统一管理接口
enum API {
  ALLPERMISSION_URL = '/admin/acl/permission',
  ADDPERMISSION_URL = '/admin/acl/permission/save',
  UPDATEPERMISSION_URL = '/admin/acl/permission/update',
  DELETEPERMISSION_URL = '/admin/acl/permission/remove/',
}

// 删除菜单数据
export const deletePermissionAPI = (id: number) => http.delete<any, any>(API.DELETEPERMISSION_URL + id)

// 添加菜单数据
export const addPermissionAPI = (data: permissionParams) => http.post<any, any>(API.ADDPERMISSION_URL, data)

// 修改菜单数据
export const updatePermissionAPI = (data: permissionParams) => http.put<any, any>(API.UPDATEPERMISSION_URL, data)

// 获取菜单数据
export const getPermissionListAPIPI = () => http.get<any, permissionListType>(API.ALLPERMISSION_URL)